<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../../include/admincontent.jsp" %>
<div id="location">当前位置：招聘实施管理 > 面试成绩管理</div>
<!-- 筛选条件 -->
<div id="sy_search" class=" f0f0f0" style="display: inline-block">
    <form id="advanceQueryParam">
        <div style="background-color: #f0f0f0">
            <div class="clearfix more_query_area">
                <div class="query_area_body clearfix">
                    <div class="record_item">
                        <div class="record_item">
                            <div class="label">方案类型</div>
                            <div class="content">
                                <div><select name="frameselecter" id="frameselecter">
                                    <option value="sz">社会招聘面试成绩管理</option>
                                    <option value="gx">高校校园招聘面试成绩管理</option>
                                    <option value="zz">中专校园招聘面试成绩管理</option>
                                    <%--                            <option value="nz">内部招聘面试成绩管理</option>--%>
                                </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="record_item">
                        <div class="record_item">
                            <div class="label">招聘方案:</div>
                            <div class="content">
                                <div><select name="pid">
                                    <option value="">请选择招聘方案</option>
                                    ${projects}
                                </select></div>
                            </div>
                        </div>
                    </div>
                    <div class="record_item">
                        <div class="record_item">
                            <div class="label">招聘环节:</div>
                            <div class="content">
                                <div><select name="fid"></select></div>
                            </div>
                        </div>
                    </div>
                    <div class="record_item">
                        <div class="toolbars">
                            <a id="searchbtn">
                                <em class="ico16 search_16"></em>
                                <span class="menu_span" title="查询">查询</span>
                            </a>
                            <a id="searchreset">
                                <em class="ico16 refresh_16"></em>
                                <span class="menu_span" title="重置">重置</span>
                            </a>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </form>
</div>

<div id="Content">

</div>
<div style="overflow:hidden;">
    <div id="div_table" style="bottom: 0px">
        <table class="layui-hide" id="table" lay-filter="scoreszTable"></table>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#frameselecter").change(() => {
            let val = $("#frameselecter option:selected").val();
            location = location.href.replace(/..$|..\/$/, val)
        })
        getproject();
        $('select[name=pid]').change(function () {
            getflow();
        });
        // $('#searchbtn').click(function () {
        //     getList();
        // });

        layui.use('table', function () {
            let table = layui.table;
            table.render({
                id: 'table'
                , elem: '#table'
                , height: 'full'
                , url: '/Do/MS/pointuser${type}Json' //数据接口
                , title: '用户表'
                , page: true //开启分页
                , cols: [[ //表头
                    , {field: 'num', title: '面试序号', width: '10%', sort: true}
                    , {field: 'educationname', title: '学历', width: '15%', sort: true}
                    , {field: 'workexperience', title: '工作经验', width: '15%', sort: true}
                    , {field: 'tel', title: '联系方式', width: '15%', sort: true}
                    , {field: 'starttime', title: '面试时间', width: '15%', sort: true}
                    , {field: 'address', title: '面试地点', width: '15%', sort: true}
                    , {
                        field: 'result', title: '录入结果', width: '15%', templet: (d) => {
                            if (d.result === "已放弃") {
                                return "<span>已放弃</span>";
                            } else if (d.result === "修改结果") {
                                return "<a href=\"javascript:score('" + d.id + "')\">修改结果</a>";
                            } else if (d.result === "已完成") {
                                return "<span>已完成</span>";
                            } else if (d.result === "录入结果") {
                                return "<a href=\"javascript:score('" + d.id + "')\">录入结果</a>";
                            }
                        }
                    }
                ]]
                , where: {
                    fid: $("select[name='fid']").val(),
                }
            });
            reload = () => {
                table.reload('table');
            }
            document.tablereload = reload;
            $("#searchbtn").on('click', () => {
                table.reload('table', {
                    where: {
                        fid: $("select[name='fid']").val(),
                    }, page: {
                        curr: 1
                    }
                })
            })
        });
    });

    //获得招聘方案
    function getproject() {
        getAjax('/Do/MS/getproject?type=${type}', null, function (data) {
            $("select[name=pid]").html(data);
            getflow();
        });
    }

    //获得面试流程
    function getflow() {
        getAjax('${path}/Do/MS/getflow?pid=' + $('select[name=pid]').val(), null, function (data) {
            $("select[name=fid]").html(data);
        });
    }

    //录入面试成绩
    function score(uid) {
        var url = '/Do/MS/score?uid=' + uid;
        openLayer('录入面试成绩', url, '98%', '98%');
    }

    function getList() {
        var fid = $("select[name=fid]").val();
        if (fid != null) {
            $('#page').myPagination({
                cssStyle: "pagination",
                ajax: {
                    on: true,
                    url: '/Do/MS/pointuser${type}?fid=' + fid,
                    dataType: 'html',
                    callback: function (data) {
                        $('#result').html(data);
                    }
                }
            });
        } else {
            $('#result').html('');
            $('#page').html('');
        }
    }
</script>
</body>
</html>